<template>
    <div class="custom-radio-wrapper" :class="{ inline: inline }">
        <input
            type="radio"
            :id="id"
            :name="name"
            :value="value"
            :checked="modelValue === value"
            @change="handleChange"
            class="custom-radio-input"
        />
        <label :for="id" class="custom-radio-label">{{ label }}</label>
    </div>
</template>

<script>
import { defineComponent } from 'vue';

export default defineComponent({
    name: 'CustomRadio',
    props: {
        id: {
            type: String,
            required: true
        },
        name: {
            type: String,
            required: true
        },
        value: {
            type: [String, Number],
            required: true
        },
        label: {
            type: String,
            required: true
        },
        modelValue: {
            type: [String, Number],
            required: true
        },
        inline: {
            type: Boolean,
            default: false
        }
    },
    emits: ['update:modelValue'],
    methods: {
        handleChange(event) {
            this.$emit('update:modelValue', event.target.value);
        }
    }
});
</script>

<style scoped>
.custom-radio-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.custom-radio-wrapper.inline {
    display: inline-flex;
    margin-right: 1rem;
    margin-bottom: 0;
}

.custom-radio-input {
    width: 1rem !important;
    height: 1rem !important;
    margin-top: 0.25rem !important;
    margin-right: 0.5rem !important;
    min-width: 1rem !important;
    max-width: 1rem !important;
    box-sizing: border-box;
}

.custom-radio-label {
    margin-bottom: 0;
    line-height: 1.5;
}
</style>
